using System.Collections;
using System.Collections.Generic;
using System.Net.Sockets;
using UnityEngine;

namespace QXFramework.Net
{
    public  class NetConfig
    {
        /// <summary>
        /// 网络连接
        /// </summary>
        public  Socket socket;
        /// <summary>
        /// 字节数组
        /// </summary>
        public  ByteArray byteArray;
        /// <summary>
        /// 消息队列
        /// </summary>
        public Queue<MessageBase> messageQueue;
        /// <summary>
        /// 是否连接中
        /// </summary>
        public  bool isConnecting;
        /// <summary>
        /// 是否关闭中
        /// </summary>
        public  bool isClosing;

        /// <summary>
        /// 发送消息队列
        /// </summary>
        public  Queue<ByteArray> sendQueue;
        /// <summary>
        /// 消息处理次数
        /// </summary>
        public  int processMessageCount;
        /// <summary>
        /// 是否使用ping
        /// </summary>
        public  bool isUsePing = true;
        /// <summary>
        /// 上次ping的时间
        /// </summary>
        public  float lastPingTime = 0;
        /// <summary>
        /// ping间隔
        /// </summary>
        public  float pingInterval;
        /// <summary>
        /// 上次pong的时间
        /// </summary>
        public  float lastPongTime = 0;
        /// <summary>
        /// udp客户端
        /// </summary>
        public  UdpClient udpClient;
    }

    public enum NetState
    {
        Close,
        ConnectSuccess,
        ConnectFailed,
    }

    public enum ServerType
    {
        Normal,
        Master,
        Slave,
    }
}